﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace T.FAS.Runtime.Metadata.Entity
{

    /// <summary>
    /// 元数据更新类型
    /// </summary>
    [JsonConverter(typeof(StringEnumConverter))]
    public enum MetaUpdateType
    {
        #region 数据建模
        [MetaUpdateDescription("数据对象")]
        Item_DataObject_this = 1001,
        [MetaUpdateDescription("数据对象的ID")]
        Item_DataObject_MetaDataID = 1002,
        [MetaUpdateDescription("数据对象的编号")]
        Item_DataObject_MetaDataCode = 1003,
        [MetaUpdateDescription("数据对象的名称")]
        Item_DataObject_MetaDataName = 1004,
        [MetaUpdateDescription("数据对象的列")]
        Item_DataObject_DataColumn_this = 1005,

        [MetaUpdateDescription("复合数据对象")]
        Item_CompositeDataObject_this = 1101,
        [MetaUpdateDescription("复合数据对象的ID")]
        Item_CompositeDataObject_MetaDataID = 1102,
        [MetaUpdateDescription("复合数据对象的编号")]
        Item_CompositeDataObject_MetaDataCode = 1103,
        [MetaUpdateDescription("复合数据对象的名称")]
        Item_CompositeDataObject_MetaDataName = 1104,
        [MetaUpdateDescription("复合数据对象的节点")]
        Item_CompositeDataObject_CompositeNodeObject_this = 1105,
        [MetaUpdateDescription("复合数据对象的元素")]
        Item_CompositeDataObject_CompositeNodeObjectElement_this = 1106,
        [MetaUpdateDescription("复合数据对象的关联")]
        Item_CompositeDataObject_Association_this = 1107,
        [MetaUpdateDescription("复合数据对象的关联项")]
        Item_CompositeDataObject_AssociateItem_this = 1108,
        [MetaUpdateDescription("复合数据对象的外键关联元素")]
        Item_CompositeDataObject_AssociationRefElement_this = 1109,

        [MetaUpdateDescription("实体对象")]
        Item_EntityObject_this = 1201,
        [MetaUpdateDescription("实体对象的ID")]
        Item_EntityObject_MetaDataID = 1202,
        [MetaUpdateDescription("实体对象的编号")]
        Item_EntityObject_MetaDataCode = 1203,
        [MetaUpdateDescription("实体对象的名称")]
        Item_EntityObject_MetaDataName = 1204,
        [MetaUpdateDescription("实体对象的属性")]
        Item_EntityObject_EntityObjectAttribute_this = 1205,

        [MetaUpdateDescription("数据查询")]
        Item_DataQuery_this = 1301,
        [MetaUpdateDescription("数据查询的ID")]
        Item_DataQuery_MetaDataID = 1302,
        [MetaUpdateDescription("数据查询的编号")]
        Item_DataQuery_MetaDataCode = 1303,
        [MetaUpdateDescription("数据查询的名称")]
        Item_DataQuery_MetaDataName = 1304,
        [MetaUpdateDescription("数据查询的数据源")]
        Item_DataQuery_DataQuerySource_this = 1305,
        [MetaUpdateDescription("数据查询的列")]
        Item_DataQuery_DataQueryColumn_this = 1306,
        [MetaUpdateDescription("数据查询的")]
        Item_DataQuery_DataQueryParam_this = 1307,
        [MetaUpdateDescription("数据查询的子查询")]
        Item_DataQuery_DataQuerySubQuery_this = 1308,

        [MetaUpdateDescription("状态机")]
        Item_StateMachine_this = 1401,
        [MetaUpdateDescription("状态机的ID")]
        Item_StateMachine_MetaDataID = 1402,
        [MetaUpdateDescription("状态机的编号")]
        Item_StateMachine_MetaDataCode = 1403,
        [MetaUpdateDescription("状态机的名称")]
        Item_StateMachine_MetaDataName = 1404,
        [MetaUpdateDescription("状态机的复合数据对象ID")]
        Item_StateMachine_CDOMetadataID = 1405,
        [MetaUpdateDescription("状态机的静态数据对象ID")]
        Item_StateMachine_SDOID = 1406,
        [MetaUpdateDescription("状态机的业务授权对象ID")]
        Item_StateMachine_BPOID = 1407,
        [MetaUpdateDescription("状态机的状态")]
        Item_StateMachine_TState_this = 1408,
        [MetaUpdateDescription("状态机的规则")]
        Item_StateMachine_TRule_this = 1409,
        [MetaUpdateDescription("状态机的规则字段")]
        Item_StateMachine_TRuleField_this = 1410,
        [MetaUpdateDescription("状态机的规则内容")]
        Item_StateMachine_TRuleContent_this = 1411,
        [MetaUpdateDescription("状态机的事件")]
        Item_StateMachine_TEvent_this = 1412,
        [MetaUpdateDescription("状态机的状态迁移")]
        Item_StateMachine_TTransition_this = 1413,
        [MetaUpdateDescription("状态机的动作")]
        Item_StateMachine_TAction_this = 1414,
        #endregion
        #region Page与Theme
        [MetaUpdateDescription("组件元数据")]
        Item_UIControl_this = 1501,
        [MetaUpdateDescription("组件元数据名称")]
        Item_UIControl_Name = 1502,
        [MetaUpdateDescription("组件元数据入参")]
        Item_UIControl_InParam = 1503,
        [MetaUpdateDescription("组件元数据事件")]
        Item_UIControl_CtrlEvent = 1504,

        [MetaUpdateDescription("界面元数据")]
        Item_Page_this = 1601,
        [MetaUpdateDescription("界面元数据编码")]
        Item_Page_Code = 1602,
        [MetaUpdateDescription("界面元数据名称")]
        Item_Page_Name = 1603,
        [MetaUpdateDescription("界面元数据入参")]
        Item_Page_InParam = 1604,
        [MetaUpdateDescription("界面元数据出参")]
        Item_Page_OutParam = 1605,

        [MetaUpdateDescription("主题元数据")]
        Item_Theme_this = 1701,
        [MetaUpdateDescription("主题元数据编码")]
        Item_Theme_Code = 1702,
        [MetaUpdateDescription("主题元数据名称")]
        Item_Theme_Name = 1703,

        [MetaUpdateDescription("菜单元数据")]
        Item_Menu_this = 1801,
        #endregion
        #region Action
        [MetaUpdateDescription("Action元数据")]
        Item_Action_this = 1901,
        [MetaUpdateDescription("Action元数据的ID")]
        Item_Action_ID = 1902,
        [MetaUpdateDescription("Action元数据的编号")]
        Item_Action_Code = 1903,
        [MetaUpdateDescription("Action元数据的名称")]
        Item_Action_Name = 1904,
        [MetaUpdateDescription("Action元数据的入参")]
        Item_Action_InParam = 1905,
        [MetaUpdateDescription("Action元数据的返回值类型")]
        Item_Action_ReturnType = 1906,
        [MetaUpdateDescription("Action元数据的返回值参数")]
        Item_Action_OutParam = 1907,
        #endregion

        //Item_元数据类型_this （若依赖）删除时使用
        [MetaUpdateDescription("审批流元数据")]
        Item_ApproveFlow_this = 2001,
        [MetaUpdateDescription("业务操作对象")]
        Item_BizPermissionObject_this = 2002,
        [MetaUpdateDescription("数据权限定义")]
        Item_DataPermissionDefinition_this = 2003,
        [MetaUpdateDescription("数据授权对象")]
        Item_DataPermissionObject_this = 2004,
        [MetaUpdateDescription("数据权限定义编号")]
        Item_DataPermissionDefinition_MetaDataCode = 2005,
        [MetaUpdateDescription("数据权限定义名称")]
        Item_DataPermissionDefinition_MetaDataName = 2006,

        [MetaUpdateDescription("待办任务")]
        Item_Task_this = 2101,
        [MetaUpdateDescription("业务流")]
        Item_WorkFlow_this = 2201,
        [MetaUpdateDescription("业务操作对象编码")]
        Item_BPO_Code = 2301,
        [MetaUpdateDescription("业务操作对象OP")]
        Item_BPO_OP = 2302,

        [MetaUpdateDescription("大数据DA数据结构")]
        Item_DA_Column = 2401,
        [MetaUpdateDescription("大数据DA编号")]
        Item_DA_Code = 2402,

        Item_StateMachine_Name,
        Item_CompositeDataObject_Name
    }


    /// <summary>
    /// 变更项注解
    /// </summary>
    public class MetaUpdateDescriptionAttribute : DescriptionAttribute
    {
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="description"></param>
        public MetaUpdateDescriptionAttribute(string description) : base(description)
        {

        }
    }
}
